package com.tomorrow.runner.activity.report;

import android.os.Bundle;
import android.view.View;

import com.tomorrow.runner.R;
import com.tomorrow.runner.activity.basic.BasicActivity;
import com.tomorrow.runner.widget.Ranger;

public class ReportActivity extends BasicActivity implements Ranger.DayViewOnClickListener, View.OnClickListener {


    Ranger mDatePicker;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_report);
        mDatePicker = (Ranger) findViewById(R.id.date_picker);
        mDatePicker.setDayViewOnClickListener(this);
        mDatePicker.setStartAndEndDateWithParts(2015,1,1,2015,1,31);
        mDatePicker.setOnControlButtonClickListener(this);
    }

    @Override
    public void onDaySelected(int day) {
        showMsgToast("Selected day " + day);
    }

    @Override
    public void onClick(View v) {
        int tag = (int) v.getTag();
        switch (tag){
            case Ranger.TAG_LEFT_BUTTON:
                mDatePicker.setStartAndEndDateWithParts(2015,1,1,2015,1,31);
                break;
            case Ranger.TAG_RIGHT_BUTTON:
                mDatePicker.setStartAndEndDateWithParts(2015,2,1,2015,2,28);
                break;
        }
    }
}
